def is_correct_brackets(nika):
    while '()' in nika or '[]' in nika or '{}' in nika:
        nika = nika.replace('()', '')
        nika = nika.replace('[]', '')
        nika = nika.replace('{}', '')


    return not nika

a = input()
print(is_correct_brackets(a))
